package ClassWork.Work_01;

import java.util.Scanner;

public class Audience {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入观众姓名：");
        String[] a = sc.nextLine().split(" ");
        for(int i = 0; i < a.length; i++){
            System.out.print(a[i] + " ");
        }
        System.out.println();
        audience(a);
    }
    public static void audience(String[] a){
        int[] x = new int[a.length];
        for(int i = 0; i < x.length; i++){
            x[i] = i;
        }
        int y = (int)(Math.random() * a.length);
        String name = "";
        for(int i = 0; i < x.length; i++){
            if(x[i] == y){
                name = a[i];
            }
        }
        System.out.print("幸运观众是：" + name);
    }
}
